package com.justnow.offer;

import java.util.Scanner;

/**
 * @author justnow
 * Created on 2020-09-10
 * Description
 *
 * 打印二叉树
 * 给定一个长度为n的连续有序数组[1, 2, 3 ... n]，计算共能构建出多少种不同的二叉搜索树
 */
public class Zuiyou02 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        if (n == 0) {
            System.out.println(0);
            return;
        }
        if (n == 1) {
            System.out.println(1);
            return;
        }
        int[] array = new int[n+1];
        array[0] = 1;
        for (int i = 1; i <= n; i++) {
            for (int root = 1; root <= i ; root++) {
                array[i] += array[root - 1] * array[i - root];
            }
        }
        System.out.println(array[n]);
    }
}
